package Model;

import Utils.TimeFormat;
import java.util.GregorianCalendar;

/**
 *
 * Class for Invoices
 * 
 * @author Group 1
 * @version 2011.03.31.
 */

public class Invoice {
	public static int id_counter = 1;
	private int invoiceNo;
    private GregorianCalendar paymentDate;
    private double amount; // totalPrice, not amount of products
    private double deliveryCharge;

    /**
     * 
     * @param invoiceNo 
     * @param paymentDate Date of payment
     * @param amount Should be the total price of the invoice.
     * @param deliveryCharge Delivery charge if needed, otherwise 0.
     */
    public Invoice(GregorianCalendar paymentDate, double amount, double deliveryCharge) {
        this.paymentDate = paymentDate;
        this.amount = amount;
        this.deliveryCharge = deliveryCharge;
    }
	public Invoice(int invoiceNo) { this.invoiceNo = invoiceNo; }
	public Invoice() {}

	public static int getNextId() {
		return ++id_counter;
	}

    public double getAmount() {
        return amount;
    }

    public void setAmount(double amount) {
        this.amount = amount;
    }

    public double getDeliveryCharge() {
        return deliveryCharge;
    }

    public void setDeliveryCharge(double deliveryCharge) {
        this.deliveryCharge = deliveryCharge;
    }

    public int getId() {
        return invoiceNo;
    }

    public void setId(int invoiceNo) {
        this.invoiceNo = invoiceNo;
    }

    public String getPaymentDate() {
        return TimeFormat.gregorian_to_string(paymentDate);
    }

    public void setPaymentDate(GregorianCalendar paymentDate) {
        this.paymentDate = paymentDate;
    }
}
